import { Component, OnInit } from '@angular/core';
import { HttpService } from '../../../services/http.service';
import { NotarizationInfoService } from '../../../services/notarization-info.service';
import { Router } from '@angular/router';
import { BaseUiService } from '../../../services/base-ui.service';

@Component({
  selector: 'app-confirminfo',
  templateUrl: './confirminfo.page.html',
  styleUrls: ['./confirminfo.page.scss'],
})
export class ConfirminfoPage implements OnInit {
  constructor(
    public router: Router,
    public baseUiService: BaseUiService,
    public HttpService: HttpService,
    public NotarizationInfoService:NotarizationInfoService,
  ) { }
  public orderId:any
  public matterName:any
  public transactorInfo:any
  public takeMobile:any
  public takeNum: any;
  ngOnInit() {
    this.orderId = this.NotarizationInfoService.getOrder()
    this.matterName = this.NotarizationInfoService.getMatters()
    this.transactorInfo = this.NotarizationInfoService.getTransactor()
    this.transactorInfo.forEach(e=>{
      if(e.gender==1){
        e.gender = '男'
      }else{
        e.gender = '女'
      }
    })
  }

  goUpdata(){
    if(this.takeMobile== ""){
      this.baseUiService.showToast('请填写手机号码','warning','top')
    }else{
      let p = {
        unitGuid:this.orderId,
        notaryState:11,
        takeMobile:this.takeMobile,
        notaryNum: this.takeNum,
        takeStyle:1,
        terminalType:1
      }
      this.HttpService.getdoSetState(p).then(res =>{
        if(res['code']==200){
          this.router.navigate(['/transaction/updata'])
        }
      })
    }
  }

}
